﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
    <div id="container" style="height: 100%"></div>
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script src="~/lib/echarts/echarts.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $.ajax({
                url: "/Home/GetResult",
                type: "post",
                success: function (data) {
                    var dom = document.getElementById("container");
                    var myChart = echarts.init(dom);
                    var app = {};
                    option = null;
                    var legend = [];
                    var xAxis = [];
                    var ecdata = [];
                    $(data).each(function (i, v) {
                        if (v.type == 0) {
                            legend.push(v.edata.name);
                            if (i == 0) {
                                $(v.edata.data).each(function (j, k) {
                                    xAxis.push(j);
                                });
                            }
                        }
                        ecdata.push(v.edata);
                    });
                    option = {
                        title: [
                            {
                                left: 'center',
                                text: '各轮奖品中奖率'
                            }, {
                                top: '55%',
                                left: 'center',
                                text: '各轮奖品余数'
                            }
                        ],
                        tooltip: {
                            trigger: 'axis'
                        },
                        xAxis: [
                            {
                                type: 'category',
                                data: xAxis
                            }, {
                                type: 'category',
                                data: xAxis,
                                gridIndex: 1
                            }
                        ],
                        grid: [{
                            bottom: '60%'
                        }, {
                            top: '60%'
                        }],
                        yAxis: [
                            {
                                type: 'value'
                            }, {
                                type: 'value',
                                gridIndex: 1
                            }
                        ],
                        series: ecdata
                    };
                    if (option && typeof option === "object") {
                        myChart.setOption(option, true);
                    }
                },
                error: function (e) {
                    alert("出错了,请稍后再试!");
                }
            });
        });
    </script>
</body>
</html>